﻿using UnityEngine;
using System.Collections;

public class GUImanager : MonoBehaviour {

	//inventory display type prefabs
	public GameObject GUIbarPrefab;
	public GameObject GUIresourceCounterPrefab;
	
	//Variables for the health gui bar creation
	GameObject healthBar;
	[HideInInspector]
	public GUIbar healthBarScript;
	public Texture2D healthBarTexture;
	public Texture2D healthBarImage;
	public Vector2 healthbarPosition;
	//this is the generic creation function for all the gui bars
	public void CreateHealthbar()
	{
		healthBar = Instantiate (GUIbarPrefab)as GameObject;
		healthBarScript = healthBar.GetComponent<GUIbar> ();
		healthBarScript.SetFillTexture (healthBarTexture);
		healthBarScript.SetSymbolTexture (healthBarImage);
		healthBarScript.SetPosition (healthbarPosition);
	}
	
	
	//Variables for the Shild gui bar creation	
	GameObject sheildBar;
	[HideInInspector]
	public GUIbar sheildBarScript;
	public Texture2D sheildBarTexture;
	public Texture2D sheildBarImage;
	public Vector2 sheildBarPosition;
	//this is the generic creation function for all the gui bars
	public void CreateSheildbar()
	{
		sheildBar = Instantiate (GUIbarPrefab)as GameObject;
		sheildBarScript = sheildBar.GetComponent<GUIbar> ();
		sheildBarScript.SetFillTexture (sheildBarTexture);
		sheildBarScript.SetSymbolTexture (sheildBarImage);
		sheildBarScript.SetPosition (sheildBarPosition);
	}
	
	//Variables for the Charge gui bar creation	
	GameObject chargeBar;
	[HideInInspector]
	public GUIbar chargeBarScript;
	public Texture2D chargeBarTexture;
	public Texture2D chargeBarImage;
	public Vector2 chargeBarPosition;
	//this is the generic creation function for all the gui bars
	public void CreateChargebar()
	{
		chargeBar = Instantiate (GUIbarPrefab)as GameObject;
		chargeBarScript = chargeBar.GetComponent<GUIbar> ();
		chargeBarScript.SetFillTexture (chargeBarTexture);
		chargeBarScript.SetSymbolTexture (chargeBarImage);
		chargeBarScript.SetPosition (chargeBarPosition);
	}
	
	//variables for the Ammo counter
	GameObject ammoCounter;
	[HideInInspector]
	public GUIcounter ammoCounterScript;
	public Texture2D ammoCounterSymbol;
	public Vector2 ammoCounterPosition;
	public Vector2 ammoCounterSize;
	public void CreateAmmoDisplay()
	{
		ammoCounter = Instantiate (GUIresourceCounterPrefab)as GameObject;
		ammoCounterScript = ammoCounter.GetComponent<GUIcounter> ();
		if(ammoCounterSymbol != null)
			ammoCounterScript.SetSymbolTexture (ammoCounterSymbol);
		ammoCounterScript.SetPosition (ammoCounterPosition);
		ammoCounterScript.SetSize (ammoCounterSize);
	}



	//variables for the Rocket counter
	GameObject rocketCounter;
	[HideInInspector]
	public GUIcounter rocketCounterScript;
	public Texture2D rocketCounterSymbol;
	public Vector2 rocketCounterPosition;
	public Vector2 rocketCounterSize;
	public void CreateRocketDisplay()
	{
		rocketCounter = Instantiate (GUIresourceCounterPrefab)as GameObject;
		rocketCounterScript = rocketCounter.GetComponent<GUIcounter> ();
		if(rocketCounterSymbol != null)
			rocketCounterScript.SetSymbolTexture (rocketCounterSymbol);
		rocketCounterScript.SetPosition (rocketCounterPosition);
		rocketCounterScript.SetSize (rocketCounterSize);
	}
	

}
